package com.itheima.demo;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @auther Macrydy
 * @date 2020/7/16 11:17
 */
public class AnnoDemo {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException {

        Class<?> clazz = Class.forName("com.itheima.demo.UseTest");

        UseTest o = (UseTest) clazz.newInstance();

        Method[] methods = clazz.getMethods();

        for (Method method : methods) {
            if (method.isAnnotationPresent(Test.class)){
                method.invoke(o);
            }
        }


    }
}
